package com.bestv.search.management.datasyn;

import org.apache.log4j.Logger;

import java.util.Map;

//$Id
public class ProgramSyncManager {

    static Logger logger = Logger.getLogger(ProgramSyncManager.class);

    public static void sync(Map<String, String> p) throws Exception {
        String sTYPE = p.get("type").toUpperCase();
        logger.info("Sync program from " + sTYPE + " @" + p.get("branch") + " with syncer: " + p.get("syncer"));
        if (sTYPE.equals("CMSDB")) {
            new CmsDbSeriesSyncer(p);
            new CmsDbProgramSyncer(p);
        } else if (sTYPE.equals("VISDB")) {
            new VisDbScheduleSyncer(p);
            new VisDbSeriesSyncer(p);
            new VisDbProgramSyncer(p);
            new VisDbProgramOfflineSyncer(p);
            new VisDbSeriesOfflineSyncer(p);
            new VisDbMovieSyncer(p);
            new VisDbMovieItemSyncer(p);
        }

        // Sync search engine series
        new SearchEngineSeriesSyncer(p);
    }
}
